Repository navigation
Generate an empty JSON object for container registry configs - #2079
Open
Bin Du (northtyphoon) wants to merge 2 commits into
Open
Bin Du (northtyphoon) wants to merge 2 commits into
Bin Du (northtyphoon) wants to merge 2 commits into
Conversation
Upload the config blob using its matching digest and advertise its two-byte size in the OCI manifest. Add focused config and upload regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7d4b68cd-b7b7-476b-a441-4e443201413b
Bin Du (northtyphoon)
requested review from
Sydney Smith (SydneyhSmith),
Aditya Patwardhan (adityapatwardhan),
alerickson,
Anam Navied (anamnavi) and
shammu1
as code owners
November 4, 2026 04:41
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
An existing nupkg/config.json can cause hashing and upload to use different files, producing a digest mismatch that makes the registry reject the publish.
1 open issue
What changed in this PR
This PR updates container registry publishing to use {} as the OCI config blob instead of an empty file, keeping the uploaded content and manifest descriptor consistent.
Changes:
- Create and upload the JSON config using its SHA-256 digest.
- Set the manifest config size to 2 bytes while preserving existing media types.
- Add offline regression tests for config content, descriptors, uploads, and upload failures.
| File | Description |
|---|---|
test/PublishPSResourceTests/ContainerRegistryConfig.Tests.ps1 |
Adds offline tests for config generation and uploading. |
src/code/ContainerRegistryServerAPICalls.cs |
Generates and uploads {} and updates the manifest config size. |
Review effort: Balanced
Choose the config filename before creating, hashing, and uploading it, and remove the helper's unreported path substitution. Cover publishing with an existing module config.json without overwriting its content. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7d4b68cd-b7b7-476b-a441-4e443201413b
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
Generate the OCI config blob as
{}instead of a zero-byte file when publishing to a container registry.nupkg/config.jsoncannot cause hashing and upload to use different files.{}(2 bytes), retainingapplication/vnd.oci.image.config.v1+json.Validation
.\build.ps1 -Build -BuildConfiguration Debug -BuildFramework net472- passed.Invoke-Pester .\test\PublishPSResourceTests\ContainerRegistryConfig.Tests.ps1 -Output Detailed -PassThru- passed, 5/5 tests on both PowerShell Core and Windows PowerShell 5.1, with the built module imported and Pester 5.7.1.git --no-pager diff --check- passed.PR Context
The config descriptor advertises a JSON media type, but the previous config blob was empty and therefore could not be parsed as JSON. Publishing an empty JSON object makes the content valid JSON while keeping the descriptor's digest and size consistent with the uploaded bytes. The package layer and existing media types are unchanged; no command syntax or documentation changes are required.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.